const Core = require('@alicloud/pop-core');
const accessKeyId = 'LTAIESUUCJVGqLfG'
const accessKeySecret = 'vjrUQBFU0CeWh4dQJ9SemGzw9exAbt'
const endpoint = 'https://iot.cn-shanghai.aliyuncs.com'
// 实例ID
const IotInstanceId  = 'iot-06z00g5bj9s3hlm'
// 产品的KEY 一个产品下包含多个设备
const ProductKey = 'k0vxy0ybgtJ'

const client = new Core({
    accessKeyId,
    accessKeySecret,
    endpoint,
    apiVersion: '2018-01-20'
});

const defaultParams = {
    ProductKey,
    IotInstanceId,
}

const requestOption = {
    method: 'POST',
    formatParams: false,
};


module.exports={
    iot(action,params){
        return client.request(action,{...params,...defaultParams},requestOption)
    }
}
